Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new .NET 6 SDK for iOS backend #7565

Merged
merged 28 commits into from
Mar 5, 2022
Merged

Use new .NET 6 SDK for iOS backend #7565

merged 28 commits into from
Mar 5, 2022

Conversation

maxkatz6
Copy link
Member

@maxkatz6 maxkatz6 commented Feb 9, 2022

Build instructions

For .NET6:

  1. Install 6.0.200 SDK
  2. Install latest workloads (might need to delete old before):
dotnet workload install --no-cache --disable-parallel ios --skip-manifest-update --source "https://pkgs.dev.azure.com/xamarin/public/_packaging/maui-main/nuget/v3/index.json" --source "https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json" --source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" --source "https://api.nuget.org/v3/index.json"
  1. Follow this guide to enable provisioning https://docs.microsoft.com/en-us/xamarin/ios/get-started/installation/device-provisioning/free-provisioning?tabs=macos
  2. You might need to set runtimeidentifier to either "iossimulator-x64" or "ios-arm64"
  3. Build ControlCatalog.iOS with latest Rider EAP or command line (will start first available simulator):
dotnet build -t:run
  1. If you run from command line, you can specify simulator or real device - Figure out 'dotnet run' CLI experience for iOS and Android dotnet/xamarin#26 (comment)

We need latest/preview workloads to have this PR merged - xamarin/xamarin-macios#12572
Without that we can't have actually working HarfBuzz - mono/SkiaSharp#1879

For legacy Xamarin.iOS

  1. Install Xamarin SDK for iOS
  2. Follow this guide to enable provisioning https://docs.microsoft.com/en-us/xamarin/ios/get-started/installation/device-provisioning/free-provisioning?tabs=macos
  3. Select either iPhone or iPhoneSimulator targets for the solution.
  4. Run ControlCatalog.iOS.Legacy project

What's not working:

  • SkiaSharp can't create SKSurface from GRContext (solved even with latest skia)
  • AOT on the real device stopped working during working on this PR. Probably some of changes broke it. (works now with interpreter enabled)

</PropertyGroup>
<ItemGroup>
<Reference Include="OpenTK-1.0" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenTK GL isn't available in net6-ios, and Xamarin team seems to migrate away from having out-of-box OpenTK, deprecating it slowly.
There is another option of having OpenTK.Graphics nuget package.
But we already have these mappings in GlInterface class used for other backends, so why not use it here.

@maxkatz6 maxkatz6 force-pushed the net6-ios branch 2 times, most recently from a5e2428 to 345fce0 Compare February 15, 2022 23:00
@maxkatz6
Copy link
Member Author

maxkatz6 commented Feb 18, 2022

WIP, screenshot is from the simulator.

simulator_screenshot_91E3F49A-1216-400B-ACB3-51304573DB71

@maxkatz6
Copy link
Member Author

IMG_0015.MOV

@rstm-sf
Copy link
Contributor

rstm-sf commented Feb 24, 2022

legacy Xamarin.iOS

It's sad 🙂

@maxkatz6
Copy link
Member Author

@rstm-sf at least it works with current IDEs.
When I started this PR net6-ios target wasn't usable at all with SkiaSharp (that has native references). It was fixed only in recent SDK update. Still there is no proper IDE support.

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0018927-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

1 similar comment
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0018927-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0018929-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

1 similar comment
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0018929-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@robloo
Copy link
Contributor

robloo commented Feb 25, 2022

This is extremely fast and performant on iPad. Is iOS phones also just as fast?

I know historically Xamarin tends to work faster on iOS than Android but I still wonder how to get this level of performance on Android. Maybe the CPU is just that much more powerful on the iPad?

@maxkatz6
Copy link
Member Author

Is iOS phones also just as fast?

I don't have any, but before it had good performance IIRC.

I still wonder how to get this level of performance on Android

No idea. It seems new Android AOT doesn't really make it as good as .NET for iOS.

Maybe the CPU is just that much more powerful on the iPad

Well, this's iPad Pro with M1 processor. So, it's expected to be way faster than any android device currently.

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0018947-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

1 similar comment
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0018947-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@maxkatz6
Copy link
Member Author

maxkatz6 commented Mar 1, 2022

NuGet package is seems to be broken:

System.TypeLoadException: Could not resolve type with token 0100009a from typeref (expected class 'System.nuint' in assembly 'Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065')
   at Avalonia.iOS.SizeSynchronizedLayerFbo.Sync() in /_/src/iOS/Avalonia.iOS/LayerFbo.cs:line 123
   at Avalonia.iOS.EaglLayerSurface.CreateGlRenderTarget() in /_/src/iOS/Avalonia.iOS/EaglLayerSurface.cs:line 88
   at Avalonia.Skia.GlRenderTarget..ctor(GRContext grContext, IGlPlatformSurface glSurface) in /_/src/Skia/Avalonia.Skia/Gpu/OpenGl/GlRenderTarget.cs:line 20
   at Avalonia.Skia.GlSkiaGpu.TryCreateRenderTarget(IEnumerable`1 surfaces) in /_/src/Skia/Avalonia.Skia/Gpu/OpenGl/GlSkiaGpu.cs:line 43
   at Avalonia.Skia.PlatformRenderInterface.CreateRenderTarget(IEnumerable`1 surfaces) in /_/src/Skia/Avalonia.Skia/PlatformRenderInterface.cs:line 163
   at Avalonia.Controls.TopLevel.CreateRenderTarget() in /_/src/Avalonia.Controls/TopLevel.cs:line 325
   at Avalonia.Controls.TopLevel.Avalonia.Rendering.IRenderRoot.CreateRenderTarget() in /_/src/Avalonia.Controls/TopLevel.cs:line 318
   at Avalonia.Rendering.DeferredRenderer.EnsureDrawingContext(IDrawingContextImpl& context) in /_/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs:line 613
   at Avalonia.Rendering.DeferredRenderer.UpdateRenderLayersAndConsumeSceneIfNeeded(IDrawingContextImpl& context, Boolean recursiveCall) in /_/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs:line 370
   at Avalonia.Rendering.DeferredRenderer.Render(Boolean forceComposite) in /_/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs:line 319
   at Avalonia.Rendering.DeferredRenderer.Avalonia.Rendering.IRenderLoopTask.Render() in /_/src/Avalonia.Visuals/Rendering/DeferredRenderer.cs:line 271
   at Avalonia.Rendering.RenderLoop.TimerTick(TimeSpan time) in /_/src/Avalonia.Visuals/Rendering/RenderLoop.cs:line 143

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0018967-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

1 similar comment
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0018967-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0018969-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

1 similar comment
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0018969-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0018975-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

1 similar comment
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0018975-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0019016-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

1 similar comment
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0019016-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@danwalmsley
Copy link
Member

Fixed the aot issues.

@danwalmsley danwalmsley merged commit 6209af4 into master Mar 5, 2022
@danwalmsley danwalmsley deleted the net6-ios branch March 5, 2022 18:00
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0019028-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

1 similar comment
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0019028-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants